<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/4/25
  Time: 20:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="application-name" content="cmv">
    <meta name="description" content="长宁区智慧规土综合分析平台">
    <meta name="author" content="上海市测绘院">
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/static/img/logo.png">

    <title>系统登录</title>
    <link type="text/css" rel="stylesheet"
          href="${pageContext.request.contextPath}/static/plugins/font-awesome/css/font-awesome.min.css"/>
    <link type="text/css" rel="stylesheet"
          href="${pageContext.request.contextPath}/static/plugins/bootstrap/css/bootstrap.min.css"/>
    <link type="text/css" rel="stylesheet"
          href="${pageContext.request.contextPath}/static/plugins/bootstrap-toastr/toastr.min.css"/>
    <link type="text/css" rel="stylesheet"
          href="${pageContext.request.contextPath}/static/plugins/simple-line-icons/simple-line-icons.min.css"/>
    <link type="text/css" rel="stylesheet"
          href="${pageContext.request.contextPath}/static/css/components.min.css"/>
    <link type="text/css" rel="stylesheet"
          href="${pageContext.request.contextPath}/static/css/plugins.min.css"/>
    <link type="text/css" rel="stylesheet"
          href="${pageContext.request.contextPath}/static/css/error.min.css"/>
    <link type="text/css" rel="stylesheet"
          href="${pageContext.request.contextPath}/static/css/layout.min.css"/>
    <link type="text/css" rel="stylesheet"
          href="${pageContext.request.contextPath}/static/css/default.min.css"/>
    <link type="text/css" rel="stylesheet"
          href="${pageContext.request.contextPath}/static/css/site.css"/>
    <link href="${pageContext.request.contextPath}/static/css/login.min.css" rel="stylesheet" type="text/css" />
</head>
<body class="login" style="height: auto;">
<div class="logo">
    <div class="title">
        <h1 class="font-white">长宁区智慧规土综合分析平台</h1>
    </div>
</div>

<div class="content">
    <form id="my-form" class="login-form" method="post">
        <h3 class="form-title" align="center">系统登录</h3>
        <div class="alert alert-danger display-hide">
            <button class="close" data-close="alert"></button>
            <span> 请输入用户名和密码 </span>
        </div>
        <div class="form-group">
            <!--ie8, ie9 does not support html5 placeholder, so we just show field title for that-->
            <label class="control-label visible-ie8 visible-ie9">用户名</label>
            <div class="input-icon">
                <i class="fa fa-user"></i>
                <input class="form-control placeholder-no-fix" type="text" autocomplete="off" placeholder="用户名" name="username" /> </div>
        </div>
        <div class="form-group">
            <label class="control-label visible-ie8 visible-ie9">密码</label>
            <div class="input-icon">
                <i class="fa fa-lock"></i>
                <input class="form-control placeholder-no-fix" type="password" autocomplete="off" placeholder="密码" name="password" /> </div>
        </div>
        <div class="form-actions">
            <label class="rememberme mt-checkbox mt-checkbox-outline">
                <input type="checkbox" name="rememberme" value="1" /> 记住账号
                <span></span>
            </label>
            <button type="submit" class="btn green pull-right"> 登录 </button>
        </div>
    </form>
</div>

<%@include file="./layout/script.jsp"%>

<script>
    $(function(){
        $.backstretch([
                "${pageContext.request.contextPath}/static/img/bg/1.jpg",
                "${pageContext.request.contextPath}/static/img/bg/2.jpg",
                "${pageContext.request.contextPath}/static/img/bg/3.jpg",
                "${pageContext.request.contextPath}/static/img/bg/4.jpg"
            ], {
                fade: 1000,
                duration: 8000
            }
        );

        $("#my-form").ajaxForm({
            dataType: 'json',
            success: function (data) {
                if (data['code'] === 200) {
                    window.location.href="${pageContext.request.contextPath}/";
                }
                else {
                    alert(data['message']);
                }
            }
        });

        $("#my-form").keydown(function(e){
            if(e.keyCode == 13){
                $("#my-form").submit();
            }
        });
    });
</script>
</body>
</html>
